﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Excel;

namespace ExcelJsonParser
{
    abstract class JsonWorkSheetBase
    {
        protected int startX = 1;
        protected int startY = 1;
        protected Microsoft.Office.Interop.Excel.Worksheet _worksheet;
        public string Name
        {
            get
            {
                string name = "";
                try
                {
                    name = _worksheet.Name;
                }
                catch (Exception)
                {
                }
                return name;
            }
        }
        protected JsonWorkSheetBase(Worksheet ws)
        {
            _worksheet = ws;
            ws.SelectionChange += new DocEvents_SelectionChangeEventHandler(ws_SelectionChange);
            ws.BeforeRightClick += new DocEvents_BeforeRightClickEventHandler(ws_BeforeRightClick);
            ws.BeforeDoubleClick += new DocEvents_BeforeDoubleClickEventHandler(ws_BeforeDoubleClick);
        }

        void ws_BeforeDoubleClick(Range Target, ref bool Cancel)
        {
            JsonWorkApp.GetInstance().ws_SelectionChange(Target);
        }

        void ws_BeforeRightClick(Range Target, ref bool Cancel)
        {
            JsonWorkApp.GetInstance().ws_SelectionChange(Target);
        }

        void ws_SelectionChange(Range Target)
        {
            JsonWorkApp.GetInstance().ws_SelectionChange(Target);
        }

        private void SetWorkSheetJson(object jsObject)
        {
        }

        private object GenerateJson()
        {
            return null;
        }
    }
}
